<?php
$this->load->model('sGlobal_model');
?>

<script type="text/javascript" src="<?php echo base_url(); ?>static/select2/select2.min.js" ></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/selectSearchGlobal.js"></script>
<!--
<link type="text/css" href="<?php echo base_url(); ?>ajaxupload/ajaxfileupload.css" rel="stylesheet" /> 
<script src="<?php echo base_url(); ?>ajaxupload/jquery.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>ajaxupload/ajaxfileupload.js" type="text/javascript"></script>
-->


<script>
    function appManagerSave() {
            $.post("<?= site_url() ?>search_global/app_mgrSave", {
                pCTab: $('#pCTab').val(),
                pCType: $('#pCType').val(),
                pCtrlID: $('#pCtrlID').val(),
                pApproval: $('#pApproval').val(),
                pNikRequestBy: $('#pNikRequestBy').val(),
                pComment: $('#pComment').val(),
                //pAccesNo: $('#pAccesNo').val()
            },
            function(data) {
                window.location = '<?php echo base_url(); ?>search_global';
            }
            );
        }
    function cancel(){
        window.location = '<?php echo base_url(); ?>search_global';
    }
</script>
<?php
    $this->load->model('sGlobal_model');
    
    foreach ($getDetail as $a) {
        $aInfoId  			= $a["INFO_ID"];
		$aInfoNik  			= $a["INFO_NIK"];
		$aInfoUntukNik  	= $a["INFO_UNTUK_NIK"];
		$aInfoAtasanNik  	= $a["INFO_ATASAN_NIK"];
		$aInfoSdate  		= $a["INFO_SDATE"];
		$aInfoShour  		= $a["INFO_SHOUR"];
		$aInfoSminute  		= $a["INFO_SMINUTE"];
		$aInfoRepetition  	= $a["INFO_REPETITION"];
		$aInfoKeterangan  	= $a["INFO_KETERANGAN"];
		$aInfoSubject  		= $a["INFO_SUBJECT"];
		$aInfoDescription  	= $a["INFO_DESCRIPTION"];
		$aName  			= $this->sGlobal_model->getName($aInfoNik);
		$aOrg  				= $this->sGlobal_model->getOrg($aInfoNik);
		$aJob  				= $this->sGlobal_model->getJobPosition($aInfoNik);
		$cName				= $this->sGlobal_model->getName($aInfoUntukNik);
		$cJob				= $this->sGlobal_model->getJobPosition($aInfoUntukNik);
		$cOrg				= $this->sGlobal_model->getOrg($aInfoUntukNik);	
		$cNameAtasan		= $this->sGlobal_model->getName($aInfoAtasanNik);
    }
?>



<div class="container">
<div class="col-md-offset-1" id="top">
    
    
<form id="formarea" role="form" method="post" action="" class="form-horizontal"  enctype="multipart/form-data"> 
    <input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" />
    <input type="hidden" value="<?php echo $cTab; ?>" id="pCTab" />
    <input type="hidden" value="<?php echo $cType; ?>" id="pCType" />
    <input type="hidden" value="<?php echo $aInfoNik;?>" id="pNikRequestBy" name="pNikRequestBy"/>

    
    
    <div class="col-md-11">
			<div class="panel panel-default">
				<div class="panel-heading">
					<h4 class="panel-title"><b class="caret"></b><b> Request By</b></h4>
				</div>
				<div class="panel-body">
					<div class="col-xs-12 col-sm-6 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-3">Name</span></label>
							<div class="col-md-7">
                            <input type="hidden" value="<?php echo $cName;?>" id="r_nama" class="select2 form-control input-sm" readonly=""/>
                            <input type="hidden" value="<?php echo $order_atasan_id;?>" id="r_mgrid" class="select2 form-control input-sm" readonly=""/>
                            <input type="hidden" value="<?php echo $cNameAtasan;?>" id="r_mgr" class="select2 form-control input-sm" readonly=""/>
                            
                            <input type="text" id="r_nameN" class="select2 form-control input-sm" value="<?php echo $aName;?>" readonly=""/>
                            </div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-3">ID Number</label>
							<div class="col-md-4">
							<input type="text" value="<?php echo $aInfoNik;?>" id="r_id" class="form-control input-sm" readonly=""/> 
							<!-- Edit by Andi Siswanto ~ before id="r_nik" -->
							</div> 
						</div>
					</div>
					<div class="col-xs-6 col-sm-6 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Departement</label>
							<div class="col-md-7">
							<input type="text" value="<?php echo $aOrg;?>" id="r_dept" class="form-control input-sm" readonly=""/>
							<!-- Edit by Andi Siswanto ~ before id="r_department" -->
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Job Position</label>
							<div class="col-md-8">
							<input type="text" value="<?php echo $aJob;?>" id="r_job" class="form-control input-sm" readonly=""/>
							</div>
						</div>
					</div>
				</div>
			</div>
            <div class="panel panel-default">
				<div class="panel-heading">
					<h4 class="panel-title"><b class="caret"></b><b> Requestor</b></h4>
				</div>
				<div class="panel-body">
					<div class="col-xs-12 col-sm-6 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-3">Name</span></label>
							<div class="col-md-7">
                            <input type="hidden" value="<?php echo $cName;?>" id="r_nama" class="select2 form-control input-sm" readonly=""/>
                            <input type="hidden" value="<?php echo $order_atasan_id;?>" id="r_mgrid" class="select2 form-control input-sm" readonly=""/>
                            <input type="hidden" value="<?php echo $cNameAtasan;?>" id="r_mgr" class="select2 form-control input-sm" readonly=""/>
                            
                            <input type="text" id="r_name2" class="select2 form-control input-sm" value="<?php echo $cName;?>" readonly=""/>
                            </div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-3">ID Number</label>
							<div class="col-md-4">
							<input type="text" value="<?php echo $aInfoUntukNik;?>" id="r_id2" class="form-control input-sm" readonly=""/> 
							<!-- Edit by Andi Siswanto ~ before id="r_nik" -->
							</div> 
						</div>
					</div>
					<div class="col-xs-6 col-sm-6 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Departement</label>
							<div class="col-md-7">
							<input type="text" value="<?php echo $cOrg;?>" id="r_dept2" class="form-control input-sm" readonly=""/>
							<!-- Edit by Andi Siswanto ~ before id="r_department" -->
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Job Position</label>
							<div class="col-md-8">
							<input type="text" value="<?php echo $cJob;?>" id="r_job2" class="form-control input-sm" readonly=""/>
							</div>
						</div>
					</div>
				</div>
			</div>
            
			<div class="panel panel-default">
				<div class="panel-heading"><h4 class="panel-title"><b class="caret"></b><b> Form</b></h4></div>
				<div class="panel-body">
					<div class="col-sm-6 col-md-6">
						<div class="form-group">
							<label class="col-md-4">Paging Info Date</label>
							<div class="col-md-6">
							     <input type="text" class="form-control text-center input-sm" id="datepicker1" value="<?php echo $aInfoSdate;?>" readonly=""/>
							</div>  
						</div>
                        <div class="form-group">
							<label class="col-md-4">Hour / Minute</label>
    						<div class="col-md-2">
    							<input type="text" id="pShour" class="form-control input-sm" value="<?php echo $aInfoShour;?>" readonly=""/>
                            </div> 
                            <label class="col-md-1">:</label>
                            <div class="col-md-2">
    							<input type="text" id="pSminute" class="form-control input-sm" value="<?php echo $aInfoSminute;?>" readonly=""/>
                            </div> 
						</div>
                        <div class="form-group">
							<label class="col-md-4">Repetition</label>
    						<div class="col-md-3">
    							<select id="pRepetition" class="form-control input-sm" readonly="">
                                    <option value="Y" <?php if($aInfoRepetition=='Y'){?>selected=""<?php } ?> >Ya</option>
                                    <option value="N" <?php if($aInfoRepetition=='N'){?>selected=""<?php } ?> >Tidak</option>
                                </select>
                            </div> 
						</div><!--
                        <div class="form-group">
							<label class="col-md-4">Jumlah Repetition</label>
    						<div class="col-md-6">
    							<input type="text" id="pRepetitionJumlah" class="form-control input-sm"/>
                            </div> 
						</div>
                        <div class="form-group">
							<label class="col-md-4">Repetition Setiap</label>
    						<div class="col-md-4">
    							<input type="text" id="pRepetitionTiap" class="form-control input-sm"/>
                            </div> 
                            <label class="col-md-2" style="font-style: italic;">Menit</label>
						</div>-->
                        <div class="form-group">
							<label class="col-md-4">Approval</label>
    						<div class="col-md-6">
    							<select class="form-control input-form select2" id="pApproval" style="width:100%">
                            			<option value="Y">Approve</option>
                                        <option value="N" selected="">Disapprove</option>
    				            </select>
                            </div> 
						</div>
					</div>
                    
					<div class="col-sm-6 col-md-6">
                        <div class="form-group">
							<label class="col-md-4">Keterangan</label>
    						<div class="col-md-8">
    							<input type="text" id="pKeterangan" class="form-control input-sm" value="<?php echo $aInfoKeterangan;?>" readonly=""/>
                            </div> 
						</div>
                        <div class="form-group">
							<label class="col-md-4">Subject</label>
    						<div class="col-md-8">
    							<input type="text" id="pSubject" class="form-control input-sm" value="<?php echo $aInfoSubject;?>" readonly=""/>
                            </div> 
						</div>
						<div class="form-group">
							<label class="col-md-4">Description</span></label>
							<div class="col-md-8">
								<textarea id="pDescription" class="form-control input-sm" style="min-width:190px;max-width:300px;min-height:100px;max-height:200px;" readonly=""><?php echo $aInfoDescription;?>
                                </textarea>
							</div>
						</div>
					</div>
                    
                    
                    
                    
					<div class="row"> 
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="control-label col-md-3"></label>
        						<div class="col-sm-2">
                                    <button type="button" class="btn btn-primary btn-block" onclick="appManagerSave();">Submit</button>
                                </div>
                                <div class="col-sm-2">
                                    <button type="button" class="btn btn-default btn-block" onclick="cancel();" >Cancel</button>
                                </div>
    				        </div>
                        </div>                   
                    </div>
				</div>
			</div>
		</div>

</form>
</div>
</div>
